﻿@model IList<ProductModel.ProductVariantModel.TierPriceModel>
@using Nop.Web.Framework.UI;
@using Nop.Web.Models.Catalog;
@using MvcContrib.UI.Grid
@{
    var displayTierPrices = false;
    if (Model.Count > 0 && !(Model.Count == 1 && Model[0].Quantity <= 1))
    {
        //When there is just one tier (with  qty 1), there are no actual savings in the list.
        displayTierPrices = true;
    }
}
@if (displayTierPrices)
{
    <div class="tier-prices">
        <div class="prices-header">
            @T("Products.TierPrices")
        </div>
        <div class="prices">
            <table class="prices-table">
                <tr>
                    <td>
                        <table class="header-table">
                            <tr>
                                <td class="field-header">
                                    @T("Products.TierPrices.Quantity")
                                </td>
                            </tr>
                            <tr>
                                <td class="field-header">
                                    @T("Products.TierPrices.Price")
                                </td>
                            </tr>
                        </table>
                    </td>
                    @foreach (var tierPrice in Model)
                    {
                        <td>
                            <table class="item-table">
                                <tr>
                                    <td class="item-quantity">
                                        @tierPrice.Quantity
                                        <text>+</text>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="item-price">
                                        @tierPrice.Price
                                    </td>
                                </tr>
                            </table>
                        </td>
                    }
                </tr>
            </table>
        </div>
    </div>
}